﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using Newtonsoft.Json;
using System.Windows.Forms;

namespace card
{
    public class HttpClass
    {

        public static T PostWebApiResult<T>(string apiUri)
        {
            var result = "";
            try
            {
                System.Net.WebClient client = new System.Net.WebClient();
                client.Headers.Add("content-type", "application/json");
                //set your header here, you can add multiple headers 
                result = Encoding.UTF8.GetString(client.UploadData(apiUri, "POST", new byte[] { }));
                //MessageBox.Show(result);

            }
            catch (System.Exception ex)
            {
                MessageBox.Show(result);
            }
            return JsonConvert.DeserializeObject<T>(result);
        }
    }

    public class HttpReValue
    {
        public string type { set; get; }
        public string content { set; get; }

    }

}
